/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package memsim.instructions;

/**
 *
 * @author Joe
 * This class handles the SHIFTS opcode and implements a logical right shift and
 * left/right arithmetic shifts
 *
 */
public class SHIFTS {

    /**
     *
     * @param op    The operand to perform the logical right shift on
     * @param shiftAmount   The amount that you would like shifted
     * @return  The shifted value
     */
    public int shiftLogicalRight(int op, int shiftAmount){
		int result;

                result = op >>> shiftAmount;

		return result;

	}
    /**
     *
     * @param op    The operand to perform the left shift on
     * @param shiftAmount   The amount that you would like shifted
     * @return  The shifted value
     */
    public int shiftLeft(int op, int shiftAmount){
		int result;

                result = op << shiftAmount;

		return result;

	}
    /**
     *
     * @param op    The operand to perform the right shift on
     * @param shiftAmount   The amount that you would like shifted
     * @return  The shifted value
     */
    public int shiftRight(int op, int shiftAmount){
		int result;

                result = op >> shiftAmount;

		return result;

	}

}
